home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / BlindAlleys.dxr / Internal_9_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.0 KB  |  105 lines

  1. property spriteNum, motion, undercard, row, location
  2. global getlist, equal, currentsel, godlist, foundation, points, tableau
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   undercard = sprite(spriteNum - 4)
  7.   location = sprite(spriteNum).loc
  8.   foundation.addProp(row, new(script("card pile")))
  9. end
  10.  
  11. on mouseDown me
  12.   if foundation[row].getcardcount() > 0 then
  13.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  14.     sprite(spriteNum).locZ = spriteNum + 1000
  15.     getlist = foundation[row]
  16.     if foundation[row].getcardcount() > 1 then
  17.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  18.     else
  19.       if foundation[row].getcardcount() = 1 then
  20.         undercard.member = member("empty", "playing cards")
  21.       end if
  22.     end if
  23.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  24.   end if
  25. end
  26.  
  27. on moving me
  28.   if the mouseDown then
  29.     sprite(spriteNum).loc = the mouseLoc
  30.   else
  31.     if the mouseUp then
  32.       sprite(spriteNum).locZ = spriteNum
  33.       motion.forget()
  34.       abort()
  35.     end if
  36.   end if
  37. end
  38.  
  39. on mouseUp me
  40.   if equal then
  41.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  42.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  43.     godlist.addCard(currentsel)
  44.     sprite(spriteNum).loc = location
  45.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  46.     if foundation[row].getcardcount() > 0 then
  47.       sprite(spriteNum).member = member(foundation[row].getlastcard().membername, "playing cards")
  48.     else
  49.       if foundation[row].getcardcount() = 0 then
  50.         sprite(spriteNum).member = member("empty", "playing cards")
  51.         undercard.member = member("empty", "playing cards")
  52.       end if
  53.     end if
  54.     if objectp(tableau[sprite(currentsel).row]) then
  55.       repeat with u in [26, 42, 58, 74, 90, 106]
  56.         if tableau[sprite(u).row].getcardcount() > 0 then
  57.           sprite(u).loc = sprite(tableau[sprite(u).row].getlastcard().spnum).location
  58.           next repeat
  59.         end if
  60.         sprite(u).loc = sprite(u).location
  61.       end repeat
  62.     end if
  63.     if not objectp(foundation[sprite(currentsel).row]) then
  64.       points = points - 10
  65.     end if
  66.     equal = 0
  67.     currentsel = 0
  68.     godlist = VOID
  69.     getlist = VOID
  70.     checkwin()
  71.   else
  72.     if not equal then
  73.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  74.       getlist = VOID
  75.       sprite(spriteNum).loc = location
  76.     end if
  77.   end if
  78.   checkwin()
  79.   repeat with u in [26, 42, 58, 74, 90, 106]
  80.     if tableau[sprite(u).row].getcardcount() > 0 then
  81.       sprite(u).loc = sprite(tableau[sprite(u).row].getlastcard().spnum).location
  82.       next repeat
  83.     end if
  84.     sprite(u).loc = sprite(u).location
  85.   end repeat
  86. end
  87.  
  88. on determinerow me
  89.   if spriteNum = 111 then
  90.     return #fone
  91.   else
  92.     if spriteNum = 112 then
  93.       return #ftwo
  94.     else
  95.       if spriteNum = 113 then
  96.         return #fthree
  97.       else
  98.         if spriteNum = 114 then
  99.           return #ffour
  100.         end if
  101.       end if
  102.     end if
  103.   end if
  104. end
  105.